﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Xml.Linq;

/// <summary>
/// Summary description for Config
/// </summary>
public static class MyConfig
{
  public static string serverPath;
  public static int RoleAdmin = 1;

  //Kich thuoc loai anh san pham 1
  public static int ImageSizeBig_Width = 1000;
  public static int ImageSizeBig_Height = 693;
  public static int ImageSizeNormal_Width = 540;
  public static int ImageSizeNormal_Height = 374;
  public static int ImageSizeThumb_Width = 140;
  public static int ImageSizeThumb_Height = 97;

  public static int CountArticle = 6;

  //Kich thuoc avatar
  public static int ImageSizeAvatar_Width = 60;
  public static int ImageSizeAvatar_Height = 60;

  public static string MailUserName = "";
  public static string MailPassWord = "";
  public static string DomainName = "";


  public static void LoadDomain()
  {
    try
    {
      XElement xml = XElement.Load(MyConfig.serverPath + "XML/Config.xml");
      XElement domain = xml.Descendants("Domain").Descendants("Name").First();
      DomainName = domain.Value;
    }
    catch { }
  }

  public static void LoadMail()
  {
    try
    {
      XElement xml = XElement.Load(MyConfig.serverPath + "Mail.xml");
      XElement mailFromName = xml.Descendants("MailFrom").Descendants("Name").First();
      XElement mailFromPass = xml.Descendants("MailFrom").Descendants("Pass").First();
      MailUserName = mailFromName.Value;
      MailPassWord = mailFromPass.Value;
    }
    catch { }
  }
}